package com.flutter_ecg.flutter_ecg.ecgapplication.utils;

import android.content.Context;
import android.util.DisplayMetrics;
import android.util.TypedValue;

public class DimenUtils {
    public DimenUtils() {
    }

    public static int sp2px(Context var0, float var1) {
        float var2 = var0.getResources().getDisplayMetrics().scaledDensity;
        return (int)(var1 * var2 + 0.5F);
    }

    public static int px2sp(Context var0, float var1) {
        float var2 = var0.getResources().getDisplayMetrics().scaledDensity;
        return (int)(var1 / var2 + 0.5F);
    }

    public static int dip2px(Context var0, int var1) {
        float var2 = var0.getResources().getDisplayMetrics().density;
        return (int)((float)var1 * var2 + 0.5F);
    }

    public static int px2dip(Context var0, float var1) {
        float var2 = var0.getResources().getDisplayMetrics().density;
        return (int)(var1 / var2 + 0.5F);
    }

    public static float px2mm(Context var0, float var1) {
        DisplayMetrics var2 = var0.getResources().getDisplayMetrics();
        float var3 = TypedValue.applyDimension(5, 1.0F, var2);
        return var1 / var3;
    }

    public static float mm2px(Context var0, float var1) {
        DisplayMetrics var2 = var0.getResources().getDisplayMetrics();
        float var3 = TypedValue.applyDimension(5, 1.0F, var2);
        return var1 * var3;
    }
}